<?php
declare(strict_types=1);
//日志文件组件
Class module_log
{
    /**
     * @param array $msg
     * @param $comment
     * @param array $menu
     * @return void
     */
    public static function create($msg = [], $comment = 0, $menu = [''])
    {
        $str_menu = implode('/', $menu);
        //记录运行日志
        $filename = DIR_PROJECT_LOGS . $str_menu . "/" . date("Y") . "/" . date('Y-m-d') . '.log';
        module_mkdir::mkdir($filename);
        //文件输出
        @file_put_contents($filename, urldecode(
                json_encode(['comment' => urlencode($comment), 'date' => date("Y-m-d H:i:s"), 'msg' => $msg])
            ) . PHP_EOL, FILE_APPEND);
    }
}